ASP.NET C# - do you need a separate datasource for each gridview? [closed]

Posted by Brian McCarthy on Pro Webmasters See other posts from Pro Webmasters or by Brian McCarthy
Published on 2011-03-10T15:38:46Z Indexed on 2011/03/10 16:19 UTC
Read the original article Hit count: 312

Filed under:
|

Do you need a separate datasource for each gridview if each gridview is accessing the same database but different tables in the database?

I'm getting an error on AppSettings that says non-invocable member. What is the problem with it?

Here's the c# code-behind:

        protected void Search_Zip_Plan_Age_Button_Click(object sender, EventArgs e)
        {
        var _with1 = this.ZipPlan_SqlDataSource;
        _with1.SelectParameters.Clear();

        _with1.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("PriceFinderConnectionString").ToString;
        _with1.SelectCommand = "ssp_get_zipcode_plan";
        _with1.SelectParameters.Add("ZipCode", this.ZipCode.Text);
        _with1.SelectParameters.Add("PlanCode", this.PlanCode.Text);
        _with1.SelectParameters.Add("Age", this.Age.Text);        

        _with1.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;

        _with1.CancelSelectOnNullParameter = false;


        Search_Results_GridView.DataBind();
        }

thanks!

© Pro Webmasters or respective owner

Related posts about ASP.NET

Related posts about c#